package com.huangssssx.loader
{
	import flash.display.Loader;
	import flash.display.LoaderInfo;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.net.URLLoader;
	import flash.net.URLRequest;

	public class ConfigLoader 
	{
		private var loader:URLLoader;
		
		public function ConfigLoader()
		{
		}
		
		public function load(path:String,backFun:Function):void
		{
			loader = new URLLoader();
			loader.addEventListener(Event.COMPLETE,function(event:Event):void
			{
				var targetLoader:URLLoader = event.target as URLLoader;
				targetLoader.removeEventListener(Event.COMPLETE,arguments.callee);
				
				var configXml:XML = new XML(loader.data);
				ResManager.getInstance().setRes(ResManager.RESOURCE_CONFIG,"resRoot", String(configXml.resRoot));
				backFun();
			});
			loader.addEventListener(IOErrorEvent.IO_ERROR,onErrorHandler);
			loader.load(new URLRequest(path));
			
		}
		
		
		private function onErrorHandler(event:Event):void
		{
		
		}
		
		
	}
}